/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fiad.model.notenverwaltung;

import fiad.model.Klasse;
import fiad.model.person.Lehrer;
import fiad.model.person.Person;
import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.Table;

/**
 *
 *
 */
@Entity
@Table(name = "kurs")
@NamedQueries({
		@javax.persistence.NamedQuery(name = "lesenKurs", query = "Select kurs FROM Kurs kurs WHERE kurs.id = :kurs"),
                @javax.persistence.NamedQuery(name = "lesenALLEKurs", query = "Select kurs FROM Kurs kurs")})
public class Kurs implements Serializable {
    @ManyToMany(mappedBy = "kurse")
    private List<Klasse> klasses;
    @Id
    @GeneratedValue

    private Long id;
    private int fach;

    
    
    @ManyToOne(cascade=CascadeType.ALL)
    private Lehrer lehrer;

   private String name;


    public Long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }


    public int getFach() {
        return fach;
    }

    public void setFach(int fach) {
        this.fach = fach;
    }

    public Person getLehrer() {
        return lehrer;
    }

    public void setLehrer(Lehrer lehrer) {
        this.lehrer = lehrer;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return name;
    }

    
    
}
